<?php
    header('Access-Control-Allow-Origin:*');
    include_once '../model/model.php';

    $model = new model();
    $model->connect();

    $email =htmlspecialchars($_GET['email']);
    $password = htmlspecialchars($_GET['password']);
    $userName = htmlspecialchars($_GET['userName']);

//    echo $email;

    if (!$email) {
        echo "email is empty";
        exit();
    }

    if (!$password) {
        echo "password is empty";
        exit();
    }

    if ($model->selectUserByEmail($email)) {
        echo "email already exist!";
        exit();
    }

    echo $model->register($email,$password,$userName);
    exit();
